{% extends "list.html" %}

{% block list_header %}
    {{ layout.query_options(search_label = 'search issues by number, year or cover') }}
{% endblock %}

{% block table_head %}
    <th>magazine</th>
    <th>number</th>
    <th>period / year</th>
    <th>cover</th>
    <th>link</th>
    <th></th>
{% endblock %}

{% block table_body %}
    {% for item in context[scaffolding.plural] %}
        <tr>
            <td><a href="{{ uri('magazines:view', key=item['publication'].urlsafe()) }}">{{ s.print_value(item['publication']) }}</a></td>
            <td><a href="{{ uri('issues:view', key=item.key.urlsafe()) }}">{{ item['number'] }}</a></td>
            <td>{{ item.period_year() }}</td>
            <td>{{ item['cover'] }}{% if item['cover_image_link'] %}<a href="{{ item['cover_image_link'] }}" target="_blank" title="link to cover image"><span class="btn-xs glyphicon glyphicon-new-window"></span></a>{% endif %}</td>
            <td>
            {% if item['link'] %}
                <a href="{{ item['link'] }}" target="_blank">{{ item.link_short() }}</a>
            {% endif %}
            </td>
            <td class="text-right">
                {{ buttons.view_edit_delete_buttons(item, target='issue') }}
            </td>
        </tr>
    {% endfor %}
{% endblock %}
